#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int getMaxLen(vector<int>& nums) {
        int n = nums.size();
        vector<int> f(n + 1), g(n + 1);

        for (int i = 1; i <= n; i++)
        {
            if (nums[i - 1] > 0) f[i] = f[i - 1] + 1, g[i] = g[i - 1] == 0 ? 0 : g[i - 1] + 1;
            else if (nums[i - 1] < 0) f[i] = g[i - 1] == 0 ? 0 : g[i - 1] + 1, g[i] = f[i - 1] + 1;
        }
        int maxlen = 0;
        for (int i = 1; i <= n; i++)
        {
            cout << f[i] << g[i] << endl;
            maxlen = max(maxlen, f[i]);
        }
        return maxlen;
    }
};